﻿using System.Collections.Generic;

namespace XamlMvp
{
    public class PresenterContext : IPresenterContext
    {
        readonly IDictionary<string, object> state;
#if WINDOWS_PHONE
        
        readonly bool isTombstone;
        readonly bool wasApplicationInstancePreserved;
        public PresenterContext(IDictionary<string, object> state, bool isTombstone, bool wasApplicationInstancePreserved)
        {
            this.state = state;
            this.isTombstone = isTombstone;
            this.wasApplicationInstancePreserved = wasApplicationInstancePreserved;
        }

        public PresenterContext(IDictionary<string, object> state, bool isTombstone)
            : this(state, isTombstone, false)
        {
        }

        public bool WasApplicationInstancePreserved
        {
            get { return wasApplicationInstancePreserved; }
        }

        public bool IsTombstone
        {
            get { return isTombstone; }
        }
#else
        public PresenterContext(IDictionary<string, object> state)
        {
            this.state = state;
        }
#endif

        public IDictionary<string, object> State
        {
            get { return state; }
        }       
    }
}
